package rwxun

import (
	"fmt"
	"net/http"
	"rwxun/controller/sign"
	"net/url"
)


func init() {
	http.HandleFunc("/", root)
	http.HandleFunc("/sign", sign.Home)
	http.HandleFunc("/sign/signupform", sign.Signupform)
	http.HandleFunc("/sign/signup", sign.Signup)
	http.HandleFunc("/sign/signinform", sign.Signinform)
	http.HandleFunc("/sign/signin", sign.Signin)
}

func root(w http.ResponseWriter, r *http.Request) {
	w.Header().Set("content-type","text/html;charset=utf-8")
	fmt.Fprintf(w,"%v",r.RemoteAddr)
	callback := url.QueryEscape(r.URL.RequestURI())
	fmt.Fprintf(w, "welcome !<a href=\"/sign/signupform?callback=%s\">注册</a>|<a href=\"/sign/signinform?callback=%s\">登录</a>",callback,callback)
}
